package cn.com.greatwall.kafka.service;

import org.apache.kafka.clients.consumer.ConsumerRecords;

import cn.com.greatwall.kafka.domain.Cluster;
import cn.com.greatwall.kafka.service.dto.ConsumerDto;
import cn.com.greatwall.kafka.util.KafkaUtil;

/**
 * @Author herw
 * @Time 2021-01-13 15:11:53
 * @Version 1.0
 * @Description: TODO(用一句话描述该文件做什么)
 */
public interface KafkaService {
    /**
     * 测试连接kafka
     * @param resources /
     * @return /
     */
    boolean testConnectionKafka(Cluster resources);
    
    /**
     * 生产消息
     * @param clusterId
     * @param topicName
     * @param key
     * @param value
     * @throws Exception
     */
    void send(String clusterId, String topicName, String key, String value) throws Exception;
    
    /**
     * 消费消息
     * @param resources
     */
    ConsumerRecords<String, String> consumer(ConsumerDto resources);
    
    KafkaUtil getKafkaUtil(String id);
}
